-
"Class not registered" When i run sp_oacreate second time!
Guys,
I am trying to run the following code.
**********************************************
DECLARE @object int, @outputcd int, @source varchar(255), @description varchar(255), @output varchar(255)
/* Create the COM object */
EXEC @outputcd = sp_OACreate 'ServerA.ClassA', @object OUT /* ServerA is an Inprocess COM server running in SQLserver mem space */
PRINT @outputcd
IF @outputcd <> 0
BEGIN
PRINT 'OLE Automation Error Information'
EXEC @outputcd = sp_OAGetErrorInfo @object, @source OUT, @description OUT
IF @outputcd = 0
BEGIN
SELECT @output = ' Source1: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
PRINT 'ERR'
END
PRINT 'DONE'
EXEC @outputcd = sp_OADestroy @object
PRint @outputcd
*************************************************
It works OK first time i run it. From next time, I get the following message.
-2147221164
OLE Automation Error Information
Source1: ODSOLE Extended Procedure
Description: Class not registered
ERR
-2147211480
If i restart it, it works ok again the first time. Any clues why this happens? I lost two days fighting this issue.
Thanks for reading
VT
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|